﻿CREATE TABLE [dbo].[GUIA_ENTRADA](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Fecha] [datetime] NOT NULL,
	[Total] [decimal](18, 2) NOT NULL,
	[NroDoc] [nvarchar](6) NOT NULL,
	[FechaEntrada] [datetime] NOT NULL,
	[IngresadoAlmacen] [bit] NOT NULL,
	[IdArea] [int] NOT NULL,
	[IdProveedor] [int] NOT NULL,
 CONSTRAINT [PK_dbo.GUIA_ENTRADA] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [FK_dbo.GUIA_ENTRADA_dbo.CENTRO_COSTO_IdArea]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[GUIA_ENTRADA]  WITH CHECK ADD  CONSTRAINT [FK_dbo.GUIA_ENTRADA_dbo.CENTRO_COSTO_IdArea] FOREIGN KEY([IdArea])
REFERENCES [dbo].[CENTRO_COSTO] ([ID])
GO

ALTER TABLE [dbo].[GUIA_ENTRADA] CHECK CONSTRAINT [FK_dbo.GUIA_ENTRADA_dbo.CENTRO_COSTO_IdArea]
GO
/****** Object:  ForeignKey [FK_dbo.GUIA_ENTRADA_dbo.PROVEEDOR_IdProveedor]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[GUIA_ENTRADA]  WITH CHECK ADD  CONSTRAINT [FK_dbo.GUIA_ENTRADA_dbo.PROVEEDOR_IdProveedor] FOREIGN KEY([IdProveedor])
REFERENCES [dbo].[PROVEEDOR] ([ID])
GO

ALTER TABLE [dbo].[GUIA_ENTRADA] CHECK CONSTRAINT [FK_dbo.GUIA_ENTRADA_dbo.PROVEEDOR_IdProveedor]
GO
CREATE NONCLUSTERED INDEX [IX_IdArea] ON [dbo].[GUIA_ENTRADA] 
(
	[IdArea] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_IdProveedor] ON [dbo].[GUIA_ENTRADA] 
(
	[IdProveedor] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]